gtk4.git
5 years agomultiselection: Don't emit nonsensical signals
Matthias Clasen [Sat, 6 Jun 2020 03:15:20 +0000 (23:15 -0400)]
multiselection: Don't emit nonsensical signals

I forgot to add a check here. We only want to emit
a ::selection-changed if we actually changed it.

5 years agoNEWS: Updates
Matthias Clasen [Sat, 6 Jun 2020 01:35:56 +0000 (21:35 -0400)]
NEWS: Updates

5 years agogtk: Documentation fixups
Matthias Clasen [Sat, 6 Jun 2020 01:36:27 +0000 (21:36 -0400)]
gtk: Documentation fixups

Document missing symbols, and other cleanups.

5 years agogdk: Documentation fixups
Matthias Clasen [Sat, 6 Jun 2020 00:59:51 +0000 (20:59 -0400)]
gdk: Documentation fixups

Document some missing symbols.

5 years agogsk: Documentation fixups
Matthias Clasen [Sat, 6 Jun 2020 00:19:45 +0000 (20:19 -0400)]
gsk: Documentation fixups

Document a few missing symbols.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Fri, 5 Jun 2020 23:55:12 +0000 (23:55 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2050

5 years agoMerge branch 'wip/ebassi/a11y-2' into 'master'
Matthias Clasen [Fri, 5 Jun 2020 23:04:21 +0000 (23:04 +0000)]
Merge branch 'wip/ebassi/a11y-2' into 'master'

Accessibility cleanup

See merge request GNOME/gtk!2049

5 years agoNEWS: Updates
Matthias Clasen [Fri, 5 Jun 2020 22:12:30 +0000 (18:12 -0400)]
NEWS: Updates

5 years agogtk-demo: Another way to trigger theme benchmark
Matthias Clasen [Fri, 5 Jun 2020 22:39:08 +0000 (18:39 -0400)]
gtk-demo: Another way to trigger theme benchmark

The click on the headerbar seems broken atm, so add
an explicit button to trigger the cycling among the
themes.

5 years agospinbuttonaccessible: Fix an oversight
Matthias Clasen [Fri, 5 Jun 2020 21:21:26 +0000 (17:21 -0400)]
spinbuttonaccessible: Fix an oversight

We need to pass the accessible to the signal handler.

5 years agoTrivial typo fix
Matthias Clasen [Fri, 5 Jun 2020 21:08:29 +0000 (17:08 -0400)]
Trivial typo fix

5 years agoa11y: Drop GtkWidgetAccessibleClass.notify_gtk
Emmanuele Bassi [Fri, 5 Jun 2020 19:31:11 +0000 (20:31 +0100)]
a11y: Drop GtkWidgetAccessibleClass.notify_gtk

It's finally unused.

Accessible types should either watch properties they are interested in
directly, or should have (private) API to allow widgets to update the
accessible state directly.

5 years agoa11y: Simplify GtkEntryAccessible
Emmanuele Bassi [Fri, 5 Jun 2020 19:27:28 +0000 (20:27 +0100)]
a11y: Simplify GtkEntryAccessible

Now that we don't have any additional subclasses of GtkEntryAccessible
in GTK, we can drop all the conditional fluff in the base class.

We still need to subscribe to the global notify signal, because of the
sheer amount of properties watched by GtkEntryAccessible.

5 years agoa11y: Implement GtkPasswordEntryAccessible properly
Emmanuele Bassi [Fri, 5 Jun 2020 19:15:28 +0000 (20:15 +0100)]
a11y: Implement GtkPasswordEntryAccessible properly

GtkPasswordEntryAccessible is not a GtkEntryAccessible any more, so it
will need a proper implementation of various interfaces and
functionality in order to work like any other entry.

5 years agoa11y: Make GtkSearchEntryAccessible a full GtkWidgetAccessible
Emmanuele Bassi [Fri, 5 Jun 2020 18:17:31 +0000 (19:17 +0100)]
a11y: Make GtkSearchEntryAccessible a full GtkWidgetAccessible

We should not inherit from GtkEntryAccessible, given that GtkSearchEntry
is *not* a GtkEntry.

5 years agoa11y: Simplify GtkScrollbarAccessible
Emmanuele Bassi [Fri, 5 Jun 2020 14:52:53 +0000 (15:52 +0100)]
a11y: Simplify GtkScrollbarAccessible

5 years agoa11y: Simplify GtkScaleButtonAccessible
Emmanuele Bassi [Fri, 5 Jun 2020 14:35:38 +0000 (15:35 +0100)]
a11y: Simplify GtkScaleButtonAccessible

5 years agoa11y: Simplify GtkSpinButtonAccessible
Emmanuele Bassi [Fri, 5 Jun 2020 13:35:10 +0000 (14:35 +0100)]
a11y: Simplify GtkSpinButtonAccessible

We're already listening to the adjustment property on the spin button,
there's no need to reset the adjustment on widget set/unset, since the
accessible instance is always tied to the same widget.

5 years agoa11y: Simplify GtkTextAccessible
Emmanuele Bassi [Fri, 5 Jun 2020 13:15:00 +0000 (14:15 +0100)]
a11y: Simplify GtkTextAccessible

5 years agoa11y: Simplify GtkTextViewAccessible
Emmanuele Bassi [Thu, 28 May 2020 14:46:42 +0000 (15:46 +0100)]
a11y: Simplify GtkTextViewAccessible

Drop the GtkWidgetAccessible.notify_gtk override.

5 years agoa11y: Simplify GtkColorSwatchAccessible
Emmanuele Bassi [Thu, 28 May 2020 14:09:02 +0000 (15:09 +0100)]
a11y: Simplify GtkColorSwatchAccessible

Drop the GtkWidgetAccessible.notify_gtk override.

5 years agoa11y: Simplify GtkNotebookAccessible
Emmanuele Bassi [Thu, 28 May 2020 13:54:57 +0000 (14:54 +0100)]
a11y: Simplify GtkNotebookAccessible

Let the GtkNotebook explicitly update the accessible object that the
current page has changed, instead of overriding
GtkWidgetAccessible.notify_gtk.

5 years agoa11y: Simplify GtkWindowAccessible
Emmanuele Bassi [Thu, 28 May 2020 13:02:04 +0000 (14:02 +0100)]
a11y: Simplify GtkWindowAccessible

Have GtkWindow notify of title changes, instead of overriding
GtkWidgetAccessible.notify_gtk.

5 years agoa11y: Simplify GtkExpanderAccessible
Emmanuele Bassi [Wed, 27 May 2020 19:02:07 +0000 (20:02 +0100)]
a11y: Simplify GtkExpanderAccessible

Drop the GtkWidgetAccessible.notify_gtk and AtkObject.initialize
overrides, and have GtkExpander update the state of the accessible
object directly.

5 years agoa11y: Simplify GtkLevelBarAccessible
Emmanuele Bassi [Wed, 27 May 2020 18:19:55 +0000 (19:19 +0100)]
a11y: Simplify GtkLevelBarAccessible

Drop the GtkWidgetAccessible.notify_gtk and AtkObject.initialize
overrides, and have GtkLevelBar notify the accessible object of value
changes.

5 years agoa11y: Split GtkSearchEntryAccessible from GtkEntryAccessible
Emmanuele Bassi [Wed, 27 May 2020 16:54:23 +0000 (17:54 +0100)]
a11y: Split GtkSearchEntryAccessible from GtkEntryAccessible

Use a separate accessible object for the GtkSearchEntry, just like we
did for GtkPasswordEntry.

5 years agoa11y: Split password entry accessible from GtkEntryAccessible
Emmanuele Bassi [Wed, 27 May 2020 15:24:31 +0000 (16:24 +0100)]
a11y: Split password entry accessible from GtkEntryAccessible

Use a separate accessible object.

5 years agoa11y: Simplify GtkProgressBarAccessible
Emmanuele Bassi [Wed, 27 May 2020 15:04:29 +0000 (16:04 +0100)]
a11y: Simplify GtkProgressBarAccessible

Drop the GtkWidgetAccessibleClass.notify_gtk and the
AtkObjectClass.initialize overrides: they don't do anything relevant.

Instead, have GtkProgressBar update the accessible state when the
fraction changes.

5 years agoa11y: Use G_DECLARE macro for GtkWidgetAccessible
Emmanuele Bassi [Mon, 27 Apr 2020 16:57:27 +0000 (17:57 +0100)]
a11y: Use G_DECLARE macro for GtkWidgetAccessible

Allows us to drop the Private structure typedef.

5 years agoa11y: Update the accessible state when GtkIconView:model changes
Emmanuele Bassi [Mon, 27 Apr 2020 16:43:28 +0000 (17:43 +0100)]
a11y: Update the accessible state when GtkIconView:model changes

Do not use a generic "notify" signal handler.

Additionally, clean up the GtkIconViewAccessible implementation to bring
it up with modern idiomatic GObject.

5 years agoa11y: Drop notify_gtk() from GtkRangeAccessible
Emmanuele Bassi [Thu, 23 Apr 2020 19:16:31 +0000 (20:16 +0100)]
a11y: Drop notify_gtk() from GtkRangeAccessible

Let the GtkRange notify the accessible instance when the adjustment
changes.

5 years agoa11y: Drop notify_gtk() from GtkButtonAccessible
Emmanuele Bassi [Thu, 23 Apr 2020 19:08:18 +0000 (20:08 +0100)]
a11y: Drop notify_gtk() from GtkButtonAccessible

Make GtkButton notify the accessible state directly when updating the
label.

5 years agoa11y: Remove GtkToggleButtonAccessible notify_gtk implementation
Emmanuele Bassi [Thu, 23 Apr 2020 18:53:37 +0000 (19:53 +0100)]
a11y: Remove GtkToggleButtonAccessible notify_gtk implementation

The base GtkWidgetAccessible class does the right thing by default.

5 years agoa11y: Update accessible state for GtkTreeView directly
Emmanuele Bassi [Thu, 23 Apr 2020 18:26:49 +0000 (19:26 +0100)]
a11y: Update accessible state for GtkTreeView directly

Do not use GtkWidgetAccessibleClass.notify_gtk().

5 years agoNotify accessibility state changes from GtkWidget
Emmanuele Bassi [Thu, 23 Apr 2020 17:01:40 +0000 (18:01 +0100)]
Notify accessibility state changes from GtkWidget

Piggybacking on blanket GObject::notify is not very efficient.

5 years agoMove orientable style classes into GtkWidget
Emmanuele Bassi [Thu, 23 Apr 2020 16:48:29 +0000 (17:48 +0100)]
Move orientable style classes into GtkWidget

It feels slightly wrong to have GtkOrientable operate on widgets, but at
least what happens when an orientable widget changes orientation should
be part of GtkWidget.

This will allow to add more state changes without accessing widget state
from the outside of gtkwidget.c.

5 years agoNotify mapped state to the accessible object directly
Emmanuele Bassi [Wed, 22 Apr 2020 19:25:48 +0000 (20:25 +0100)]
Notify mapped state to the accessible object directly

Do not use signal connections: if we have an accessible object, notify
it directly when getting mapped and unmapped.

5 years agoDrop unused AtkRegistry path
Emmanuele Bassi [Wed, 22 Apr 2020 19:06:55 +0000 (20:06 +0100)]
Drop unused AtkRegistry path

We expect widgets to use their own derived GtkWidgetAccessible type,
these days, and given that we hard code the default accessible type of a
GtkWidget to GtkWidgetAccessible, and that we enforce the dependency of
the type passed to gtk_widget_class_set_accessible_type(), the registry
code path is clearly unused.

5 years agoMake tooltip properties idiomatic
Emmanuele Bassi [Wed, 22 Apr 2020 18:32:17 +0000 (19:32 +0100)]
Make tooltip properties idiomatic

The tooltip handling in GtkWidget is "special":

 - the string is stored inside the qdata instead of the private
   instance data
 - the accessors call g_object_set() and g_object_get(), and the
   logic is all inside the property implementation, instead of
   being the other way around
 - the getters return a copy of the string
 - the setters don't really notify all the involved properties

The GtkWidgetAccessible uses the (escaped) tooltip text as a source for
the accessible object description, which means it has to store the
tooltip inside the object qdata, and update its copy at construction and
property notification time.

We can simplify this whole circus by making the tooltip properties (text
and markup) more idiomatic:

 - notify all side-effect properties
 - return a constant string from the getter
 - if tooltip-text is set:
   - store the text as is
   - escape the markup and store it separately for the markup getter
 - if tooltip-markup is set:
   - store the markup as is
   - parse the markup and store it separately for the text getter

The part of the testtooltips interactive test that checks that the
getters are doing the right thing is now part of the gtk testsuite, so
we ensure we don't regress in behaviour.

5 years agoUse modern GObject macros for GtkAccessible
Emmanuele Bassi [Mon, 20 Apr 2020 15:47:50 +0000 (16:47 +0100)]
Use modern GObject macros for GtkAccessible

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Fri, 5 Jun 2020 19:25:46 +0000 (19:25 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2048

5 years agomultiselection: Fix the select_range implementation
Matthias Clasen [Fri, 5 Jun 2020 17:49:32 +0000 (13:49 -0400)]
multiselection: Fix the select_range implementation

When exclusive is TRUE, we would not always emit a
::selection-changed signal that covers all the items
that were unselected.

This commit includes a test.

5 years agoset: Fix gtk_set_get_max
Matthias Clasen [Fri, 5 Jun 2020 01:35:53 +0000 (21:35 -0400)]
set: Fix gtk_set_get_max

This function had an off-by-one error. Thankfully,
our selection tests are thorough enough to catch it.

5 years agodropdown: Connect a forgotten signal handler
Matthias Clasen [Fri, 5 Jun 2020 18:26:30 +0000 (14:26 -0400)]
dropdown: Connect a forgotten signal handler

The code was exporting a search_stop function, but
the ui file didn't connect it to the ::stop-search
signal. Fix that.

5 years agoMerge branch 'frame-clock-start-time' into 'master'
Matthias Clasen [Fri, 5 Jun 2020 18:33:48 +0000 (18:33 +0000)]
Merge branch 'frame-clock-start-time' into 'master'

Tweaks to frame clock for better ties to vsync

See merge request GNOME/gtk!2043

5 years agoMerge branch 'master.msvc' into 'master'
Matthias Clasen [Fri, 5 Jun 2020 18:31:08 +0000 (18:31 +0000)]
Merge branch 'master.msvc' into 'master'

Fix latest GTK master on Visual Studio

See merge request GNOME/gtk!2028

5 years agoMerge branch 'columnview-reorder-cells' into 'master'
Matthias Clasen [Fri, 5 Jun 2020 18:29:26 +0000 (18:29 +0000)]
Merge branch 'columnview-reorder-cells' into 'master'

Columnview reorder cells

See merge request GNOME/gtk!2047

5 years agoMerge branch 'rubberband-again' into 'master'
Matthias Clasen [Fri, 5 Jun 2020 17:59:15 +0000 (17:59 +0000)]
Merge branch 'rubberband-again' into 'master'

Rubberband again

See merge request GNOME/gtk!2041

5 years agomultiselection: Fix the select_range implementation
Matthias Clasen [Fri, 5 Jun 2020 17:49:32 +0000 (13:49 -0400)]
multiselection: Fix the select_range implementation

When exclusive is TRUE, we would not always emit a
::selection-changed signal that covers all the items
that were unselected.

This commit includes a test.

5 years agoset: Add a few useful functions
Matthias Clasen [Fri, 5 Jun 2020 01:35:53 +0000 (21:35 -0400)]
set: Add a few useful functions

Allow to find out if a set is empty, and its
min and max.

5 years agocolumnview: Update column positions on reordering
Matthias Clasen [Fri, 5 Jun 2020 16:40:32 +0000 (12:40 -0400)]
columnview: Update column positions on reordering

Tell reordered columns to reorder their cells to
the new position. This is necessary to get things
like separators right. The visible symptom of this
problem was the lack of the right border when the
last column is reorder to another position, since
the title widget was still the last in its container,
so :last-child applied.

5 years agocolumnviewcolumn: Add private api to set the position
Matthias Clasen [Fri, 5 Jun 2020 16:39:48 +0000 (12:39 -0400)]
columnviewcolumn: Add private api to set the position

This is needed to make columns reorder their cells when
their position in the column views list of columns
changes.

5 years agolistitemwidget: Add api to reorder children
Matthias Clasen [Fri, 5 Jun 2020 16:39:00 +0000 (12:39 -0400)]
listitemwidget: Add api to reorder children

We need this to keep the rows in sync with the columns
when they are reordered.

5 years agocolumnviewlayout: Handle for_size propertly
Matthias Clasen [Fri, 5 Jun 2020 15:34:51 +0000 (11:34 -0400)]
columnviewlayout: Handle for_size propertly

When we are given a for_size as width for the whole
column view, we need to distribute it over the columns
as gtk_column_view_allocate_columns would, in order
to find out which for_size to give to each cell.

This is a bit recursive, but works. Since we are
doing this recursion for every row, we should consider
adding a cache for those distributed widths.

5 years agoMerge branch 'wip/damaged-but-no-frost-bite' into 'master'
Ray Strode [Fri, 5 Jun 2020 15:58:37 +0000 (15:58 +0000)]
Merge branch 'wip/damaged-but-no-frost-bite' into 'master'

x11: defer _NET_WM_FRAME_DRAWN update until frame usable by compositor

See merge request GNOME/gtk!1982

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Fri, 5 Jun 2020 15:38:03 +0000 (15:38 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

gtk-demo: Bring back the applauncher demo

See merge request GNOME/gtk!2040

5 years agoMerge branch 'ebassi/for-master' into 'master'
Emmanuele Bassi [Fri, 5 Jun 2020 15:29:41 +0000 (15:29 +0000)]
Merge branch 'ebassi/for-master' into 'master'

Add missing annotation

See merge request GNOME/gtk!2046

5 years agocolumnview: Split gtk_column_view_allocate_columns
Matthias Clasen [Fri, 5 Jun 2020 15:24:55 +0000 (11:24 -0400)]
columnview: Split gtk_column_view_allocate_columns

Split off a helper function that just distributes
the widths, without actually allocating the columns.

This will be used in measuring in the future.

5 years agocolumnview: Take column width into account for measuring
Matthias Clasen [Fri, 5 Jun 2020 13:37:59 +0000 (09:37 -0400)]
columnview: Take column width into account for measuring

When measuring the height of a cell, we need to give
it it the width of its column, if we expect realistic
results.

5 years agox11: Defer _NET_WM_FRAME_DRAWN update until frame usable by compositor
Ray Strode [Wed, 27 May 2020 19:12:35 +0000 (15:12 -0400)]
x11: Defer _NET_WM_FRAME_DRAWN update until frame usable by compositor

With the vendor provided Nvidia driver there is a small window of time
after drawing to a GL surface before the updates to that surface
can be used by the compositor.

Drawing is already coordinated with the compositor through the frame
synchronization protocol detailed here:

https://fishsoup.net/misc/wm-spec-synchronization.html

Unfortunately, at the moment, GdkX11Surface tells the compositor the
frame is ready immediately after drawing to the surface, not later,
when it's consumable by the compositor.

This commit defers announcing the frame as ready until it's consumable
by the compositor. It does this by listening for the X server to announce
damage events associated with the frame drawing.  It tries to find the
right damage event by waiting until fence placed at buffer swap time
signals.

5 years agox11: Factor out some of frame sync code into subroutines
Ray Strode [Tue, 2 Jun 2020 20:29:03 +0000 (16:29 -0400)]
x11: Factor out some of frame sync code into subroutines

This commit moves some of the end frame sync counter handling
code to subroutines.

It's a minor readability win, but the main motivation is to
make it easier in a subsequent commit to defer updating the
sync counter until a more appropriate time.

5 years agox11: Add back support for the damage extension
Ray Strode [Wed, 27 May 2020 18:53:10 +0000 (14:53 -0400)]
x11: Add back support for the damage extension

commit 14bf58ec5dfdf19e3ca603b977626608dafc729b dropped support
for using the DAMAGE extension since there was no code that
needed it.

We're going to need it again, however, to address an NVidia
vendor driver issue.

This commit does the plumbing to add it back.

5 years agofilechooserwidget: Avoid an uninitialised value
Timm Bäder [Fri, 5 Jun 2020 04:26:56 +0000 (06:26 +0200)]
filechooserwidget: Avoid an uninitialised value

For NULL filters, we were never calling g_list_store_find, so leaving
filter_index undefined.

5 years agodemos: Avoid shadowing a global from time.h
Timm Bäder [Fri, 5 Jun 2020 04:26:25 +0000 (06:26 +0200)]
demos: Avoid shadowing a global from time.h

Sad but true.

5 years agofilterlistmodel: Fix fallthrough annotations in unreachable code
Timm Bäder [Fri, 5 Jun 2020 04:19:34 +0000 (06:19 +0200)]
filterlistmodel: Fix fallthrough annotations in unreachable code

They are only unreachable in debug builds but still break the build on
clang.

5 years agocolumview: Make cells propagate request mode
Matthias Clasen [Fri, 5 Jun 2020 13:37:21 +0000 (09:37 -0400)]
columview: Make cells propagate request mode

I think this is necessary to make wrapping
labels work.

5 years agogtk-demo: Improve wrapping in settings demo
Matthias Clasen [Fri, 5 Jun 2020 13:35:56 +0000 (09:35 -0400)]
gtk-demo: Improve wrapping in settings demo

The columnview overrides the width of its content,
so if a label is not willing to wrap its content
below a certain width, it will just get cut off.

Avoid that by not setting width-chars on the wrapping
content.

5 years agoAdd missing annotation
Emmanuele Bassi [Fri, 5 Jun 2020 13:33:17 +0000 (14:33 +0100)]
Add missing annotation

5 years agocolumviewlayout: Skip children when we should
Matthias Clasen [Fri, 5 Jun 2020 12:44:23 +0000 (08:44 -0400)]
columviewlayout: Skip children when we should

Every layout manager should call gtk_widget_should_layout
on their children before measuring or allocating them.
So do it here too.

5 years agolistview: Add an example to the docs
Matthias Clasen [Fri, 5 Jun 2020 00:11:35 +0000 (20:11 -0400)]
listview: Add an example to the docs

The example is an excerpt from the applauncher
demo in gtk4-demo.

5 years agogtk-demo: Bring back the applauncher demo
Matthias Clasen [Thu, 4 Jun 2020 19:44:39 +0000 (15:44 -0400)]
gtk-demo: Bring back the applauncher demo

Just without the coverflow. It was a well-documented
demo, so it is useful to keep around.

5 years agoframe clock: schedule in refresh intervals
Yariv Barkan [Sat, 30 May 2020 21:23:24 +0000 (00:23 +0300)]
frame clock: schedule in refresh intervals

When the application does not receive "frame drawn" signals we schedule
the clock to run more or less at intervals equal to the last known
refresh interval. In order to minimize clock skew we have to aim for
exact intervals.

5 years agoframe clock: Better handle non-regular clock cycles
Alexander Larsson [Fri, 5 Jun 2020 09:30:47 +0000 (11:30 +0200)]
frame clock: Better handle non-regular clock cycles

We try to step the frame clock in whole refresh_interval steps, but to
avoid drift and rounding issues we additionally try to converge it to
be synced to the physical vblank (actually the time we get the
frame-drawn message from the compositor, but these are tied together).

However, the convergence to vsync only really makes sense if the new
frame_time actually is tied to the vsync. It may very well be that
some other kind of event (say a network or mouse event) triggered
the redraw, and not a vsync presentation.

We used to assume that all frames that are close in time (< 4 frames
apart) were regular and thus tied to the vsync, but there is really no
guarantee of that. Even non regular times could be rapid.

This commit changes the code to only do the convergence-to-real-time
if the cause of the clock cycle was a thaw (i.e. last frame drawn and
animating). Paint cycles for any other kind of reason are always
scheduled an integer number of frames after the last cycle that was
caused by a thaw.

5 years agoframe clock: Track if paint is caused by thaw or not
Alexander Larsson [Fri, 5 Jun 2020 09:16:57 +0000 (11:16 +0200)]
frame clock: Track if paint is caused by thaw or not

When we get to a paint cycle we now know if this was caused by a
thaw, which typically means last frame was drawn, or some other event.

In the first case the time of the cycle is tied to the vblank in some
sense, and in the others it is essentially random. We can use this
information to compute better frame times. (Will be done in later
commits.)

5 years agoMerge branch 'cleanup-snapshot-inhibit' into 'master'
Benjamin Otte [Fri, 5 Jun 2020 07:38:52 +0000 (07:38 +0000)]
Merge branch 'cleanup-snapshot-inhibit' into 'master'

reftest: Clean up reftest_inhibit_snapshot()

See merge request GNOME/gtk!2034

5 years agoDrop gtk_multi_selection-copy
Matthias Clasen [Fri, 5 Jun 2020 04:15:09 +0000 (00:15 -0400)]
Drop gtk_multi_selection-copy

It is not used anymore.

5 years agolistbase: Redo rubberbanding
Matthias Clasen [Fri, 5 Jun 2020 02:30:47 +0000 (22:30 -0400)]
listbase: Redo rubberbanding

Make it so that the selection is only updated in the end.

5 years agodemos/gtk-demo/listview*.c: Include stdlib.h
Chun-wei Fan [Thu, 4 Jun 2020 08:35:02 +0000 (16:35 +0800)]
demos/gtk-demo/listview*.c: Include stdlib.h

atoi() and qsort() both require this header for them to be defined

5 years agomodules: Fix build on Visual Studio
Chun-wei Fan [Thu, 4 Jun 2020 08:27:56 +0000 (16:27 +0800)]
modules: Fix build on Visual Studio

Visual Studio does not allow decorating functions with '__declspec (dllexport)'
if a prototype exists and is not decorated with '__declspec (dllexport)' as
well, so we cannot just decorate g_io_module_[load|unload|query] in the various
module sources with G_MODULE_EXPORT because the prototypes of these functions
have been marked with _GLIB_EXTERN, which equates to 'extern' unless overridden

Fix this by overriding _GLIB_EXTERN with the appropriate visibility flag, as we
have used to define _GDK_EXTERN.  Unfortunately, we can't just use _GDK_EXTERN
G_MODULE_EXPORT as they may have not been defined yet for our use

Do this across the board for all modules, even if they are not buildable on
Visual Studio nor Windows, for consistency's sake.

5 years agoMerge branch 'fix-quadratic-add' into 'master'
Timm Bäder [Fri, 5 Jun 2020 02:57:38 +0000 (02:57 +0000)]
Merge branch 'fix-quadratic-add' into 'master'

Avoid quadratic slowdown in gtk_widget_add()

See merge request GNOME/gtk!2027

5 years agoAdd gtk_selection_model_[un]select_callback
Matthias Clasen [Fri, 5 Jun 2020 01:33:44 +0000 (21:33 -0400)]
Add gtk_selection_model_[un]select_callback

Add a methods to add or remove a whole set
(specified via a query-range style callback).

5 years agoset: Add a few useful functions
Matthias Clasen [Fri, 5 Jun 2020 01:35:53 +0000 (21:35 -0400)]
set: Add a few useful functions

Allow to find out if a set is empty, and its
min and max.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Thu, 4 Jun 2020 21:17:21 +0000 (21:17 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

more documentation for list widgets

See merge request GNOME/gtk!2039

5 years agoMerge branch 'fribidi-include' into 'master'
Matthias Clasen [Thu, 4 Jun 2020 20:03:13 +0000 (20:03 +0000)]
Merge branch 'fribidi-include' into 'master'

wayland: Remove unused fribidi include

See merge request GNOME/gtk!2037

5 years agodocs: Expand list widget docs
Matthias Clasen [Thu, 4 Jun 2020 19:33:53 +0000 (15:33 -0400)]
docs: Expand list widget docs

Begin to flesh out the long descriptions for GtkListView,
GtkGridView and GtkColumnView.

5 years agowayland: Remove unused fribidi include
Sebastian Keller [Thu, 4 Jun 2020 18:44:55 +0000 (20:44 +0200)]
wayland: Remove unused fribidi include

The included fribidi header is not used in gdkkeys-wayland.c and already
included in gdk.c which causes linker issues due to the header defining
a global variable.

5 years agogtk-demo: Cosmetics
Matthias Clasen [Thu, 4 Jun 2020 17:28:21 +0000 (13:28 -0400)]
gtk-demo: Cosmetics

Remove a few instances of double semicolon.

5 years agoMerge branch 'matthiasc/for-master' into 'master'
Matthias Clasen [Thu, 4 Jun 2020 16:32:21 +0000 (16:32 +0000)]
Merge branch 'matthiasc/for-master' into 'master'

gtk-demo: Allow editing in the settings demo

See merge request GNOME/gtk!2033

5 years agoMerge branch 'list-widget-styles' into 'master'
Matthias Clasen [Thu, 4 Jun 2020 16:27:37 +0000 (16:27 +0000)]
Merge branch 'list-widget-styles' into 'master'

List widget styles

Closes #2818

See merge request GNOME/gtk!2035

5 years agoMerge branch 'demo-drop-awards' into 'master'
Matthias Clasen [Thu, 4 Jun 2020 15:27:23 +0000 (15:27 +0000)]
Merge branch 'demo-drop-awards' into 'master'

gtk-demo: Drop the awards

See merge request GNOME/gtk!2036

5 years agoAvoid quadratic slowdown in gtk_widget_add()
Alexander Larsson [Thu, 4 Jun 2020 08:15:03 +0000 (10:15 +0200)]
Avoid quadratic slowdown in gtk_widget_add()

If you add a widget to a parent, this will invalidate the css nodes
for parent/siblings. Afterwards, if the parent is mapped, we will
realize the new child. This calls gtk_widget_update_alpha() which
needs the css opacity, so it revalidates the css.

Thus, for each widget_add (while visible) will trigger a full
revalidation of each sibling. If you add N children to a parent that
leads to O(N^2) revalidations.

To demo this I changed gtk-demo to always double the count
(independent of the fps) and print the time it took. Here is the
results (after a bit):

Setting fishbowl count=256 took 3,4 msec
Setting fishbowl count=512 took 10,1 msec
Setting fishbowl count=1024 took 34,1 msec
Setting fishbowl count=2048 took 126,3 msec
Setting fishbowl count=4096 took 480,3 msec
Setting fishbowl count=8192 took 1892,7 msec
Setting fishbowl count=16384 took 7751,0 msec
Setting fishbowl count=32768 took 38097,7 msec
Setting fishbowl count=65536 took 191987,7 msec

To fix this we drop gtk_widget_update_alpha() and just
calculate it when needed (which is only in a single place).
It was really only necessary because we previously set
the alpha on the surface.

With this fix the above becomes:

Setting fishbowl count=256 took 1,0 msec
Setting fishbowl count=512 took 1,9 msec
Setting fishbowl count=1024 took 3,7 msec
Setting fishbowl count=2048 took 7,4 msec
Setting fishbowl count=4096 took 18,1 msec
Setting fishbowl count=8192 took 31,0 msec
Setting fishbowl count=16384 took 66,3 msec
Setting fishbowl count=32768 took 126,7 msec
Setting fishbowl count=65536 took 244,6 msec
Setting fishbowl count=131072 took 492,2 msec
Setting fishbowl count=262144 took 984,3 msec

5 years agogtk-demo: Drop the awards
Matthias Clasen [Thu, 4 Jun 2020 14:19:44 +0000 (10:19 -0400)]
gtk-demo: Drop the awards

This was a neat idea, but maintaining it at a sufficient
level is too much work.

5 years agolist widgets: Document css structure
Matthias Clasen [Thu, 4 Jun 2020 14:05:17 +0000 (10:05 -0400)]
list widgets: Document css structure

We didn't fill in this expected part of the widget
documentation yet.

5 years agoMerge branch 'ensure-style-no-recurse' into 'master'
Benjamin Otte [Thu, 4 Jun 2020 14:04:55 +0000 (14:04 +0000)]
Merge branch 'ensure-style-no-recurse' into 'master'

Avoid recursion in gtk_css_node_ensure_style()

See merge request GNOME/gtk!2031

5 years agodocs: Fix a parameter name mismatch
Matthias Clasen [Thu, 4 Jun 2020 13:51:07 +0000 (09:51 -0400)]
docs: Fix a parameter name mismatch

5 years agoChange css names of list widget
Matthias Clasen [Thu, 4 Jun 2020 12:42:55 +0000 (08:42 -0400)]
Change css names of list widget

The new names are

GtkListView - listview row
GtkGridView - gridview child
GtkColumView - columnview header
               columnview listview row

Adwaita css has been updated to preserve
existing styles.

Fixes: #2818
5 years agoreftest: Clean up reftest_inhibit_snapshot()
Alexander Larsson [Thu, 4 Jun 2020 13:45:29 +0000 (15:45 +0200)]
reftest: Clean up reftest_inhibit_snapshot()

This was done in a weird way where we always call reftest_uninhibit_snapshot()
on paint, and then re-inhibited it if it wasn't inhibited. To make this
work it also started with an extra inhibit.

This is very contorted and based on how this historically worked. This
changes it to just do:

  if (inhibit_count > 0)
    return;

And keep inhibit_count at its initial zero value unless it is actually
inhibited.

5 years agoMerge branch 'fix-snapshot' into 'master'
Benjamin Otte [Thu, 4 Jun 2020 13:43:44 +0000 (13:43 +0000)]
Merge branch 'fix-snapshot' into 'master'

snapshot: Fix assert if paint gets scheduled immediately

See merge request GNOME/gtk!2032

5 years agogtk-demo: Allow editing in the settings demo
Matthias Clasen [Wed, 3 Jun 2020 23:33:45 +0000 (19:33 -0400)]
gtk-demo: Allow editing in the settings demo

This gives us an example of a columnview with editable
content, which we didn't have so far.

5 years agosnapshot: Fix assert in inhibition
Alexander Larsson [Thu, 4 Jun 2020 10:37:48 +0000 (12:37 +0200)]
snapshot: Fix assert in inhibition

In https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/2027 i was getting

Bail out! ERROR:../testsuite/reftests/reftest-snapshot.c:212:reftest_uninhibit_snapshot: assertion failed: (inhibit_count > 0)

In (for example the box-shadow-changes-modify-clip reftest. I can reproduce this (on master) with:

```
$ xvfb-run -a -s "-screen 0 1024x768x24" meson test --suite gtk:reftest "reftest box-shadow-changes-modify-clip.ui"
...
1/1 gtk:reftest / reftest box-shadow-changes-modify-clip.ui ERROR          0.77s
``

Fix this by re-inhibiting if we didn't draw anything, or we will get an assert the next paint.